/*
 * Copyright (c) 2010-2011 Josef Hardi <josef.hardi@gmail.com>
 * Copyright (c) 2010 Piotr Zagawa <piotr.zagawa@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package id.duapuluhdua.dakidaki.data.tables;

import id.duapuluhdua.dakidaki.UserAlert.Result;
import id.duapuluhdua.dakidaki.data.common.DataColumn;
import id.duapuluhdua.dakidaki.data.common.DataTable;
import id.duapuluhdua.dakidaki.data.common.DataValues;
import id.duapuluhdua.dakidaki.data.common.Database;

/**
 *
 */
public class DataTableGeoPoints extends DataTable
{
  public final static String tableName = "GeoPoints";

  public static class column
  {
    public static final int ID = 0;
    public static final int TrackID = 1;
    public static final int Lon = 2;
    public static final int Lat = 3;
    public static final int Altitude = 4;
    public static final int TimeUTC = 5;
    public static final int Accuracy = 6;
    public static final int Speed = 7;
    public static final int Bearing = 8;
    public static final int CreationTime = 9;
  };

  private final static DataColumn[] vecTableDefinition =
  {
    new DataColumn(column.ID, DataTable.COL_ID, DataColumn.TYPE_INT, false, true, false),
    new DataColumn(column.TrackID, "TrackID", DataColumn.TYPE_INT, false, false, false),
    new DataColumn(column.Lon, "Lon", DataColumn.TYPE_NUMERIC, false, false, true),
    new DataColumn(column.Lat, "Lat", DataColumn.TYPE_NUMERIC, false, false, true),
    new DataColumn(column.Altitude, "Altitude", DataColumn.TYPE_INT, false, false, false),
    new DataColumn(column.TimeUTC, "TimeUTC", DataColumn.TYPE_INT, false, false, false),
    new DataColumn(column.Accuracy, "Accuracy", DataColumn.TYPE_INT, true, false, false),
    new DataColumn(column.Speed, "Speed", DataColumn.TYPE_INT, true, false, false),
    new DataColumn(column.Bearing, "Bearing", DataColumn.TYPE_INT, true, false, false),
    new DataColumn(column.CreationTime, "CreationTime", DataColumn.TYPE_INT, false, false, false),
  };

  public DataTableGeoPoints(Database database)
  {
      super(database, tableName, vecTableDefinition);
//      rows = new RowSet(this);
  }

  @Override
  public DataValues getNewValues(boolean forInsert)
  {
    final DataValues values = new DataValues(this);

    if (forInsert) {
      // Do nothing.
    }
    return values;
  }

  /**
   * Gets the current version of table structure.
   *
   * @return a version number.
   */
  @Override
  public int getTableVersion()
  {
    return 1;
  }

  @Override
  public Result validateValues(DataValues values)
  {
    return null;  // TODO assume all OK.
  }
}
